﻿Option Strict On
Option Explicit On 

''' -----------------------------------------------------------------------------
''' Project	 : IPCommon
''' Class	 : Core.IPCommon.CSystemLog_301
''' 
''' -----------------------------------------------------------------------------
''' <summary>
''' Log cac message cua he thong ra file, hoac messagebox
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' 	[csung]	2/22/2005	Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class CSystemLog_301

#Region "Nhiệm vụ của Class"
    '************************************************************************
    '* Created by: Csung, 2003-11
    '* Xử lý các exception của hệ thống 
    '* - Chú ý: Class này thuộc lớp cuối cùng, sẽ không reference đến một lớp nào khác
    '*
    '************************************************************************
#End Region

#Region "Variables "
    Private Shared m_strRunMode As String = IPConstants.C_RUNMODE_NOT_LOADED
#End Region

#Region "class public interface"
    Public Shared Sub Initialize()
        If m_strRunMode = IPConstants.C_RUNMODE_NOT_LOADED Then
            m_strRunMode = IPConstants.C_RUNMODE_RUNTIME
        End If
    End Sub
    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' xử lý lỗi theo các trường hợp khác nhau 
    ''' tạm thời dùng theo kiểu select-case,
    ''' nếu có nhu cầu cụ thể sẽ chuyển sang dạng strategy
    ''' </summary>
    ''' <param name="i_exp">exception tao ra</param>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[csung]	2/22/2005	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Shared Sub ExceptionHandle(ByVal i_exp As System.Exception)
        Try
            Initialize()
            Select Case m_strRunMode
                Case IPConstants.C_RUNMODE_TEST
                    System.Windows.Forms.MessageBox.Show("FMS-TEST: " & i_exp.Message, "IP-log")
                Case IPConstants.C_RUNMODE_DEVELOP
                    System.Windows.Forms.MessageBox.Show("FMS-DEVELOPE: " & i_exp.Message, "IP-log")
                Case IPConstants.C_RUNMODE_RUNTIME
                    System.Windows.Forms.MessageBox.Show("FMS-RUNTIME: " & i_exp.Message, "IP-log")
            End Select
        Catch
            System.Windows.Forms.MessageBox.Show("eschool- Không có file Ini")
        End Try
    End Sub
#End Region
End Class
